use single_thread_final::{parse_request_line, RequestLine};

#[test]
fn parse_request_line_extracts_method_path_version() {
    let line = "GET /hello HTTP/1.1";
    let parsed = parse_request_line(line);

    assert_eq!(
        parsed,
        RequestLine {
            method: "GET".into(),
            path: "/hello".into(),
            version: "HTTP/1.1".into()
        }
    );
}

#[test]
fn parse_request_line_handles_missing_fields() {
    let line = "GET /";
    let parsed = parse_request_line(line);

    assert_eq!(
        parsed,
        RequestLine {
            method: "GET".into(),
            path: "/".into(),
            version: "".into()
        }
    );
}